package com.ruoyi.common.utils;

import com.ruoyi.project.sdi.sdiImage.domain.SdiImage;

import java.util.List;

public class SdiFilePathTool {
	public static String toSdiFilePathString(List<SdiImage> sdiImages,
			String imagePathPrefix) {
		String sdiFilePathString = "";
		for (SdiImage image : sdiImages) {
			String sdiFilePath = image.getSdifilepath();
			String sdiFilePathL = image.getSdifilepathL();
			String backSdiFilePath = sdiFilePathL;
			if (sdiFilePath.equals(sdiFilePathL)) {
				int seqNo = Integer.parseInt(sdiFilePath.substring(sdiFilePath
						.length() - 12, sdiFilePath.length() - 4));
				++seqNo;
				String s = String.format("%08d", seqNo);
				backSdiFilePath = sdiFilePath.substring(0,
						sdiFilePath.length() - 12)
						+ s + ".JPG";
			}
			sdiFilePathString += "http://" + imagePathPrefix + sdiFilePath;
			sdiFilePathString += "@@@http://" + imagePathPrefix + backSdiFilePath + ";";
		}

		if (!sdiFilePathString.equals("")) {
			sdiFilePathString = sdiFilePathString.substring(0, sdiFilePathString.length() - 1);
		}
		return sdiFilePathString;
	}
}
